//==========================
// - FileName:      	CommonUtil.cs         
// - Created:         	Wu	
// - CreateTime:    	2023-07-16 22:59:08	
// - Email:         	1479136868@qq.com		
// - Region:        		
// - Description:   
//==========================
using System.Collections.Generic;
using System.Collections;
using System;
using System.Linq;
using System.Reflection;
using UnityEngine.UI;
using UnityEngine;

namespace Framework
{
    public class CommonUtil
    {
        public static Vector2 GetRandomPoint(Image image)
        {
            int width = (int)image.rectTransform.rect.width;
            int height = (int)image.rectTransform.rect.height;
            int x = UnityEngine.Random.Range(-width / 2, width / 2);
            int y = UnityEngine.Random.Range(-height / 2, height / 2);
            return new Vector2(x, y);
        }

        public static MethodInfo GetMethod(string className, string methodName)
        {
            var hotUpdateAss = AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "Assembly-CSharp");
            Type type = hotUpdateAss.GetType(className);
            return type.GetMethod(methodName);
        }
    }
}
